/*
 * Copyright © 2024-2025 Wenze Wei
 *
 * This file is part of StadionOS.
 *
 * This Source Code Form is subject to the terms of the GNU General Public License, v. 2.0.
 * You can obtain a copy of the GPL at
 * https://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 */

#include "../include/fsd.h"

/**
 * @brief Extracts the base name from a file path.
 *
 * This function takes a file path as input and returns a pointer to the base
 * name of the file. The base name is the part of the path after the last slash ('/').
 * If there is no slash in the path, the function returns a pointer to the original path.
 *
 * @param path The file path from which to extract the base name.
 * @return const char* A pointer to the base name of the file.
 */
const char* Sbasename(const char* path) {
	const char *base = Sstrchr(path, '/');
	return base ? base + 1: path;
}
